home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 2003 August / TommyVideo.iso / flash / volumes / volume_5.swf / scripts / %3Cdefault package%3E / FLabelSymbol.as < prev    next >
Encoding:
Text File  |  2003-06-08  |  1.5 KB  |  57 lines

  1. _global.FLabelClass = function()
  2. {
  3.    if(this.hostComponent == undefined)
  4.    {
  5.       this.hostComponent = this._parent.controller != undefined ? this._parent.controller : this._parent;
  6.    }
  7.    if(this.customTextStyle == undefined)
  8.    {
  9.       if(this.hostComponent.textStyle == undefined)
  10.       {
  11.          this.hostComponent.textStyle = new TextFormat();
  12.       }
  13.       this.textStyle = this.hostComponent.textStyle;
  14.       this.enable = true;
  15.       this.visible = false;
  16.    }
  17. };
  18. FLabelClass.prototype = new MovieClip();
  19. Object.registerClass("FLabelSymbol",FLabelClass);
  20. FLabelClass.prototype.setLabel = function(label)
  21. {
  22.    var val = this.hostComponent.styleTable.embedFonts.value;
  23.    if(val != undefined)
  24.    {
  25.       this.labelField.embedFonts = val;
  26.    }
  27.    this.labelField.setNewTextFormat(this.textStyle);
  28.    this.labelField.text = label;
  29.    this.labelField._height = this.labelField.textHeight + 2;
  30. };
  31. FLabelClass.prototype.setSize = function(width)
  32. {
  33.    this.labelField._width = width;
  34. };
  35. FLabelClass.prototype.setEnabled = function(enable)
  36. {
  37.    this.enable = enable;
  38.    var tmpColor = this.hostComponent.styleTable[!enable ? "textDisabled" : "textColor"].value;
  39.    if(tmpColor == undefined)
  40.    {
  41.       tmpColor = !enable ? 8947848 : 0;
  42.    }
  43.    this.setColor(tmpColor);
  44. };
  45. FLabelClass.prototype.getLabel = function()
  46. {
  47.    return this.labelField.text;
  48. };
  49. FLabelClass.prototype.setVisible = function(boolean)
  50. {
  51.    this.visible = boolean;
  52. };
  53. FLabelClass.prototype.setColor = function(col)
  54. {
  55.    this.labelField.textColor = col;
  56. };
  57.